package cn.py.boot_lua.controller;

import cn.py.boot_lua.service.GetPathSerHelper;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/path")
public class PathController {

    private final GetPathSerHelper getPathSerHelper;
    public PathController(GetPathSerHelper getPathSerHelper) {
        this.getPathSerHelper = getPathSerHelper;
    }

    @GetMapping("/name/{catalog}")
    public Map<String, String> getDynamicPath(@PathVariable String catalog) {
        String fullPath = getPathSerHelper.getPath(catalog);
        Map<String, String> response = new HashMap<>();
        response.put("catalog", catalog);
        response.put("fullPath", fullPath);
        return response;
    }



}
